<?php

class UsersController extends CController {

    public function filters() {
        return array(
            'accessControl', // perform access control for CRUD operations
        );
    }

    public function accessRules() {
        return array(
            array(
                "allow",
                "actions" => array("index", "view", "manage_users"),
                "users" => array("admin"),
            ),
            array('deny', // deny all users
                'users' => array('*'),
            ),
        );
    }

    public function actionView() {
        $model = User::model()->findByPk($_GET["id"]);
        if ($model === null)
            throw new CHttpException(404, 'The requested ID does not exist.');
        $this->render('view_users', array(
            'model' => $model,
        ));
    }

    public function actionManage_users() {
        $model = new User('search');
        if (isset($_GET['User']))
            $model->attributes = $_GET['User'];
        $rendervar = array('model' => $model);
        $this->render('manage_users', $rendervar);
    }

}

?>